package com.oracle.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.oracle.entity.Cart;
import com.oracle.mapper.CartMapper;
import com.oracle.service.ICartService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author fjx
 * @since 2021-07-07
 */
@Service
public class CartServiceImpl extends ServiceImpl<CartMapper, Cart> implements ICartService {

        @Autowired
        private CartMapper cartMapper;

        @Override
        public Cart selectCartByUserIdAndBookId(Integer userId, Integer bookId) {
                QueryWrapper<Cart> queryWrapper=new QueryWrapper<>();
                queryWrapper.eq("userid", userId);
                queryWrapper.eq("bookid", bookId);
                Cart cart = cartMapper.selectOne(queryWrapper);
                return cart;
        }
}
